import fetch from '@/utils/request'

export function page(query) {
  return fetch({
    url: '/api/admin/user/pageList',
    method: 'post',
    data: query
  })
}

export function addObj(obj) {
  return fetch({
    url: '/api/admin/user',
    method: 'post',
    data: obj
  })
}

export function getObj(id) {
  return fetch({
    url: '/api/admin/user/' + id,
    method: 'get'
  })
}

export function delObj(id) {
  return fetch({
    url: '/api/admin/user/' + id,
    method: 'delete'
  })
}

export function putObj(id, obj) {
  return fetch({
    url: '/api/admin/user/' + id,
    method: 'put',
    data: obj
  })
}

export function getUserRoles(id, obj) {
  return fetch({
    url: '/api/admin/userRole/' + id + '/roles',
    method: 'get',
    data: obj
  })
}

export function addUserObj(obj) {
  return fetch({
    url: '/api/admin/user/add',
    method: 'post',
    data: obj
  })
}

export function updateUserPwd(obj) {
  return fetch({
    url: '/api/admin/user/updateUserPwd',
    method: 'post',
    data: obj
  })
}

export function resetUserPwd(obj) {
  return fetch({
    url: '/api/admin/user/resetUserPwd',
    method: 'post',
    data: obj
  })
}

export function sendSmsCode(obj) {
  return fetch({
    url: '/api/adminCrm/smsManage/sendSmsCode',
    method: 'post',
    data: obj
  })
}

export function resetUserPhone(obj) {
  return fetch({
    url: '/api/admin/user/resetUserPhone',
    method: 'post',
    data: obj
  })
}

export function addUserPhone(obj) {
  return fetch({
    url: '/api/admin/user/addUserPhone',
    method: 'post',
    data: obj
  })
}
